// 导航栏图标滑动特效
// $(document).ready(function(){
// 	$("div.aside ul.aside-menu .submenu:eq(0)").mouseover(function(){
// 		$(".aside-menu li a i b").css("left","0px");
// 	})
// })

//左侧导航栏特效
$(document).ready(function(){
	$("i.slide").click(function(){
		if($("div.content").css("marginLeft") == "0px"){
			$("div.content").animate({marginLeft:'200px'}, 400);
			$("div.aside").animate({marginLeft:'0px'}, 400);
		} else {
			$("div.content").animate({marginLeft:'0px'}, 400);
			$("div.aside").animate({marginLeft:'-200px'}, 400);
		}

	})
})

//二级菜单滑动
$(document).ready(function(){
	$("div.aside div.aside-menu .submenu").click(function(){
		$(this).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("400");
		if($(this).find("span>i").hasClass("fa-angle-down")){
		$(this).find("span>i").removeClass("fa-angle-down").addClass("fa-angle-up");
		$(this).find("span>i").parents("div.submenu").siblings("div.submenu").find("span>i").addClass("fa-angle-down").removeClass("fa-angle-up");		
		} else {
		$(this).find("span>i").addClass("fa-angle-down").removeClass("fa-angle-up");
		}
	});
});

//按钮零件特效
$(document).ready(function(){
	$("p button.more_less").click(function(){
		if ($(this).find("span.more").css("display") == "block") {
			$(this).find("span.more").hide();
			$(this).find("span.less").show();
		} else {
			$(this).find("span.more").show();
			$(this).find("span.less").hide();
		}
	})

	$("p button.upload_success").click(function(){
		if ($(this).find("span.upload").css("display") == "block") {
			$(this).find("span.upload").hide();
			$(this).find("span.success").show();
		} else {
			$(this).find("span.upload").show();
			$(this).find("span.success").hide();
		}
	})

	$("p button.heart").click(function(){
		if ($(this).find("i.heart_o").css("display") == "block") {
			$(this).find("i.heart_o").hide();
			$(this).find("i.heart_danger").show();
		} else {
			$(this).find("i.heart_o").show();
			$(this).find("i.heart_danger").hide();
		}
	})

	$("p button.finger").click(function(){
		if ($(this).find("span.finger_up").css("display") == "block") {
			$(this).find("span.finger_up").hide();
			$(this).find("span.finger_down").show();
		} else {
			$(this).find("span.finger_up").show();
			$(this).find("span.finger_down").hide();
		}
	})

	$("p button.save").click(function(){
		$(this).find("#span1").text("Saving...");
		$("p i.saving").show();
	})


	$("div.sex label").click(function(){
		$(this).find("i").addClass("fa-check");
		if ($(this).find("i").hasClass("fa-check")) {
		$(this).siblings().find("i").removeClass("fa-check");
		} 
	})
})

// 简单轮播
$(document).ready(function(e) {
    $('.Unslider1').unslider({
		dots: true
	});
});

//带有箭头的轮播
$(document).ready(function(e) {
    var unslider2 = $('.Unslider2').unslider({
		dots: true
	}),
	data2 = unslider2.data('unslider');
	$('.unslider-arrow2').click(function() {
        var fn = this.className.split(' ')[1];
        data2[fn]();
    });

});


//3D轮播
$(document).ready(function () {
    /*图片位置数据*/
    var datas = [
        {'z-index': 6, opacity: 1, width: 532, height: 231, top: 40, left: 0},
        {'z-index': 4, opacity: 0.6, width: 392, height: 170, top:80, left: -225},
        {'z-index': 3, opacity: 0.4, width: 336, height: 142, top: -10, left: -170},
        {'z-index': 2, opacity: 0.2, width: 434, height: 188, top: -60, left: 110},
        {'z-index': 3, opacity: 0.4, width: 336, height: 142,  top: -10, left: 430},
        {'z-index': 4, opacity: 0.6, width: 392, height: 170, top: 80, left: 420},
    ]
    move();

    function move() {
        /*图片分布*/
        for (var i = 0; i < datas.length; i++) {
            var data = datas[i];
            $('#slide ul li').eq(i).css('z-index',data['z-index']);
            $('#slide ul li').eq(i).stop().animate(data, 1200);
        }
    }

    /*左箭头事件*/
    $('.prev').on('click', function () {
        var last = datas.pop();
        datas.unshift(last);

        move();
    })

    /*右箭头事件处理函数*/
    function nextYewu(){
        var first = datas.shift();
        datas.push(first);
        move();
    }
    /*右箭头事件*/
    $('.next').on('click', nextYewu);

    /*自动播放*/
    var timer = setInterval(function(){
        nextYewu();
    },5000);
    /*鼠标进入slide显示箭头,清除自动播放*/
    $('#slide').on({
        mouseenter: function () {
            $('.arrow').css('display', 'block');
            clearInterval(timer);
        }, mouseleave: function () {
            $('.arrow').css('display', 'none');
            /*鼠标离开时自动播放*/
            clearInterval(timer);
            timer = setInterval(function(){
                nextYewu();
            },5000)
        }
    })
})

$(document).ready(function(){ $(".flipster1").flipster({ style: 'carousel', start: 0 }); });

	$(function(){
		
		/*$(".flipster").flipster({
			enableNav: true
		});*/
		$(".flipster2").flipster({
			itemContainer: 			'ul', // Container for the flippin' items.
			itemSelector: 			'li', // Selector for children of itemContainer to flip
			style:							'coverflow', // Switch between 'coverflow' or 'carousel' display styles
			start: 							'center', // Starting item. Set to 0 to start at the first, 'center' to start in the middle or the index of the item you want to start with.
			
			enableKeyboard: 		true, // Enable left/right arrow navigation
			enableMousewheel: 	true, // Enable scrollwheel navigation (up = left, down = right)
			enableTouch: 				true, // Enable swipe navigation for touch devices
			
			enableNavButtons: 	true, // If true, flipster will insert Previous / Next buttons
			
			onItemSwitch: 			function(){}, // Callback function when items are switches
		});
	
	});














